﻿[#include "/app/common/layout/__backstagemainlayout.html"/]

[#assign pageJavascript]
<script>
function select1() {
	$.ajax(
    {
    	type: "post",
    	url: "${ContextPath}/admin/handler",
    	data: { "type": "afacher" },
        success: function (msg) {
        	$("#selectFapartment").append("<option value=''>请选择一级部门</option>");
        	for (var i = 0; i < msg.afacherList.length; i++) {
            	$("#selectFapartment").append("<option value=" + msg.afacherList[i].id + ">" + msg.afacherList[i].name + "</option>");
        	}
            select2();
        }
	})
};
function select2() {
	$("#selectApartment").html("");
	$("#selectPosition").html("");
	$.ajax(
	{
		type: "post",
		url: "${ContextPath}/admin/handler",
		data: { "type": "achilren","typeid":$('#selectFapartment').val() },
		success: function (msg) {
			$("#selectApartment").append("<option value=''>请选择二级部门</option>");
			$("#selectPosition").append("<option value=''>请选择职位</option>");
			for (var i = 0; i < msg.achilrenList.length; i++) {
				$("#selectApartment").append("<option value=" + msg.achilrenList[i].id + ">" +msg.achilrenList[i].name + "</option>");
			}
			for (var i = 0; i < msg.pList.length; i++) {
				$("#selectPosition").append("<option value=" + msg.pList[i].id + ">" +msg.pList[i].name + "</option>");
			}
		}
	})
};

$(function(){
	select1();
	$('#selectFapartment').bind("change", select2);
});

</script>
[/#assign]

[#assign pageCss]
<link rel="stylesheet"
	href="${ContextPath}/admin/assets/css/signin.css" />
[/#assign]

[@mainlayout pageJavascript=pageJavascript pageCss=pageCss currentMenu="organizationFlag-userFlag-addUserFlag"]
<div class="page-header">
	<h1>
		<a href="${ContextPath}/admin/user">用户管理</a>
		<small> <i class="ace-icon fa fa-angle-double-right"></i> 新增用户</small>
	</h1>
</div>
<form class="form-horizontal" role="form"  action="${ContextPath}/admin/doadduser" method="post" >
	[#include "_form.html" /]
</form>
[/@mainlayout]